package cn.momoshenchi.pojo;

import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;


import javax.validation.constraints.*;
import java.io.Serializable;

/**
 * @version : 1.0
 * @author: momoshenchi
 * @date: 2021/3/23 - 13:55
 */
public class Student implements Serializable
{

    private Integer id;

    public Integer getId()
    {
        return id;
    }

    public void setId(Integer id)
    {
        this.id = id;
    }

    @NotBlank(message = "学号不能为空")
    @Length(min = 8,max = 8,message = "学号必须为8位")
    private String studentId;


    @Range(max = 1,min = 0)
    private Integer gender;

    @NotBlank(message = "身份证不能为空")
    @Length(min = 16, max = 18, message = "身份证长度必须在18位以内")
    private String number;

    @Email(message = "请输入正确的邮箱")
    @NotBlank(message = "邮箱不能为空")
    private String email;


    public String getStudentId()
    {
        return studentId;
    }

    public void setStudentId(String studentId)
    {
        this.studentId = studentId;
    }

    public Integer getGender()
    {
        return gender;
    }

    public void setGender(Integer gender)
    {
        this.gender = gender;
    }

    public String getNumber()
    {
        return number;
    }

    public void setNumber(String number)
    {
        this.number = number;
    }

    public String getEmail()
    {
        return email;
    }

    public void setEmail(String email)
    {
        this.email = email;
    }

    public Student(@NotBlank(message = "学号不能为空") @Length(min = 8, max = 8) String studentId, @Range(max = 1, min = 0) Integer gender, @NotBlank(message = "身份证不能为空") @Length(min = 16, max = 18, message = "身份证长度必须在18位以内") String number, @Email(message = "请输入正确的邮箱") @NotBlank(message = "邮箱不能为空") String email)
    {
        this.studentId = studentId;
        this.gender = gender;
        this.number = number;
        this.email = email;
    }

    public Student()
    {
        this.studentId = "1";
        this.gender = 1;
        this.number = "number";
        this.email = "e";
    }
}
